#ifndef BORROWRETURNWIDGET_H
#define BORROWRETURNWIDGET_H

#include <QLCDNumber>
#include <QLineEdit>
#include <QPushButton>
#include <QTableWidget>
#include <QTextBrowser>
#include <QTextEdit>
#include <QWidget>
#include <QSerialPort>

class ElaPlainTextEdit;
class ElaLineEdit;
class ElaPushButton;
class ElaTableView;
class ElaLCDNumber;

class BorrowReturnWidget : public QWidget
{
    Q_OBJECT
public:
    explicit BorrowReturnWidget(QWidget *parent = nullptr);
    ~BorrowReturnWidget();

    void initUI();
signals:
private slots:
    void onRfidDataReceived();

    void onBorrowClicked();
    void onReturnClicked();

private:

    QWidget *leftPanel;
    // 左侧控件
    ElaLineEdit *cardEdit;
    ElaLineEdit *bookEdit;
    ElaPushButton *borrowBtn;
    ElaPushButton *returnBtn;
    ElaPushButton *printBtn;


    QWidget *rightPanel;
    // 右侧控件
    ElaTableView *recordTable;
    ElaPlainTextEdit *logBrowser;
    ElaLCDNumber *timerLCD;

    QSerialPort *rfid;
    void setupLeftPanel();
    void setupRightPanel();
    void initConnections();
};

#endif // BORROWRETURNWIDGET_H
